.NET Framework Class Library |
ConcurrentDictionary<(Of <(TKey, TValue>)>)..::.TryGetValue Method |
ConcurrentDictionary<(Of <(TKey, TValue>)>) Class See Also Send Feedback |
Attempts to get the value associated with the specified key from the ConcurrentDictionary<(Of <(TKey, TValue>)>).
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function TryGetValue ( _ key As TKey, _ <OutAttribute> ByRef value As TValue _ ) As Boolean |
C# |
---|
public bool TryGetValue( TKey key, out TValue value ) |
Parameters
- key
- Type: TKey
The key of the value to get.
- value
- Type:
TValue
%
When this method returns, value contains the object from the ConcurrentDictionary<(Of <(TKey, TValue>)>) with the spedified key or the default value of TValue, if the operation failed.
Return Value
true if the key was found in the ConcurrentDictionary<(Of <(TKey, TValue>)>); otherwise, false.Implements
IDictionary<(Of <(TKey, TValue>)>)..::.TryGetValue(TKey, TValue%)Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | key is a null reference (Nothing in Visual Basic). |